<?php
	include_once("includes/common.php");

	switch ($url[0]) {
		case 'prepare': //no server side processing required, but leave here just in case required, easy to uncomment
			//if(PREPARATION_PHASE) include_once(SERVER_DIR."prepare.php");
			break;
		case 'nominate':
			if(NOMINATION_PHASE) {
				include_once(SERVER_DIR."nominate.php");
				//for the nominate me widget
				$js .= "<script type='text/javascript' src='".HTTP_SERVER.SCRIPT_DIR."nominate.js'></script>";
			}
			break;
		case 'judge': //no server side processing required, but leave here just in case required, easy to uncomment
			//if(JUDGING_PHASE) include_once(SERVER_DIR."judge.php");
			break;
		case 'vote':
			if(VOTING_PHASE) {
				include_once(SERVER_DIR."vote.php");
				$js .= "<script type='text/javascript' src='".HTTP_SERVER.SCRIPT_DIR."vote.js'></script>
								<script defer='defer' id='snap_preview_anywhere' type='text/javascript' src='http://spa.snap.com/snap_preview_anywhere.js?ap=1&amp;key=c7d0433d82f35957109900e5c320bf92&amp;sb=1&amp;th=orange&amp;cl=0&amp;si=0&amp;oi=0&amp;link_icon=on&amp;preview_trigger=both&amp;domain=2007.sablogawards.com'></script>";
			}
			break;
		case 'finish': //no server side processing required, but leave here just in case required, easy to uncomment
			//if(FINISHED_PHASE) include_once("server_finish.php");
			break;
    case 'contact':
			include_once(SERVER_DIR."contact.php");
			$js .= "<script type='text/javascript' src='".HTTP_SERVER.SCRIPT_DIR."contact.js'></script>";
			break;
		case 'login':
			include_once(SERVER_DIR."login.php");
			$js .= "<script type='text/javascript' src='".HTTP_SERVER.SCRIPT_DIR."login.js'></script>";
			break;
		case 'logout':
			include_once("logout.php");
			exit;
			break;
		default:
			//if(PREPARATION_PHASE) include_once(SERVER_DIR."prepare.php");
			if(NOMINATION_PHASE) { 
				include_once(SERVER_DIR."nominate.php");
				//for the nominate me widget
				$js .= "<script type='text/javascript' src='".HTTP_SERVER.SCRIPT_DIR."nominate.js'></script>";
			}
			//if(JUDGING_PHASE) include_once(SERVER_DIR."judge.php");
			if(VOTING_PHASE) {
				include_once(SERVER_DIR."vote.php");
				$js .= "<script type='text/javascript' src='".HTTP_SERVER.SCRIPT_DIR."vote.js'></script>
								<script defer='defer' id='snap_preview_anywhere' type='text/javascript' src='http://spa.snap.com/snap_preview_anywhere.js?ap=1&amp;key=c7d0433d82f35957109900e5c320bf92&amp;sb=1&amp;th=orange&amp;cl=0&amp;si=0&amp;oi=0&amp;link_icon=on&amp;preview_trigger=both&amp;domain=2007.sablogawards.com'></script>";
			}
			//if(FINISHED_PHASE) include_once(SERVER_DIR."finish.php");
			break;
	}
?>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title><?php echo $meta_title; ?></title>
	<meta http-equiv="Content-Language" content="en" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="<?php echo $meta_keywords; ?>" />
	<meta name="description" content="<?php echo $meta_description; ?>" />
	<meta name="robots" content="index, follow, all" />
	<meta name="rating" content="General" />
	<meta name="revisit-after" content="7 days" />
	<meta name="audience" content="All" />
	<meta name="objecttype" content="Document" />
	<meta name="author" content="Miguel dos Santos" />
	<?php echo $js; ?>
	<?php echo $styles; ?>
</head>
<body>
	<noscript><style type='text/css'>.hideme { display:block; } .spinner {display:none;}</style></noscript>
	<?php 
		include("top.php"); 
		echo "<div id='content'>";
		switch ($url[0]) {
			case 'prepare':
				if(PREPARATION_PHASE) include_once("prepare.php");
				else echo "<h2 class='header'>Preparation Phase Over</h2><p>Sorry, the preparation phase is over, maybe you can help us prepare next time.</p>";
				break;
			case 'nominate':
				if(NOMINATION_PHASE) include_once("nominate.php");
				else echo "<h2 class='header'>Nomination Phase Over</h2><p>Sorry, the nomination phase is over.</p>";
				break;
			case 'judge':
				if(JUDGING_PHASE) include_once("judge.php");
				else echo "<h2 class='header'>Shortlisting Phase</h2><p>Sorry, the shortlisting phase of the SA blog awards, either hasn't begun yet, or is aleady over.</p><p>However which way, it's not now. Please check the homepage to see when this will happen.</p>";
				break;
			case 'vote':
				if(VOTING_PHASE) include_once("vote.php");
				else echo "<h2 class='header'>Voting Phase</h2><p>Sorry, the voting phase of the SA blog awards, either hasn't begun yet, or is aleady over.</p><p>However which way, it's not now. Please check the homepage to see when this will happen.</p>";
				break;
			case 'finish':
				if(FINISHED_PHASE) include_once("finish.php");
				else echo "<h2 class='header'>Awards still in progress</h2><p>Sorry, you can't skip to the end of these awards just yet. Check out the awards details on the homepage to see when the it ends.</p>";
				break;
	    case 'contact':
				include_once("contact.php");
				break;
			case 'login':
				include_once("login.php");
				break;
			default: 
				include_once("home.php"); //default homepage text and then show the phase specific content
				if(PREPARATION_PHASE) include_once("prepare.php");
				if(NOMINATION_PHASE) include("nominate.php");
				if(JUDGING_PHASE) include_once("judge.php");
				if(VOTING_PHASE) include_once("vote.php");
				if(FINISHED_PHASE) include_once("finish.php");
				break;
		}
		echo "</div>";
		include("footer.php"); 
	?>
	<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script>
	<script type="text/javascript">
		_uacct = "UA-179359-9";
		urchinTracker();
	</script>
</body>
</html>